CC = mpicc
CC2 = gcc
CFLAGS = -fopenmp
ARRUMA_MPI = export OMPI_CC=gcc-4.2;

all:
	$(ARRUMA_MPI)
	$(CC) smallTextParallel.c processaFrase.c -o smallTextParallel $(CFLAGS);	
	$(CC2) smallTextSequential.c processaFrase.c -o smallTextSequential;
	$(CC) bigTextParallel.c eratostenes.c -o bigTextParallel $(CFLAGS);
	$(CC2) bigTextSequential.c eratostenes.c -o bigTextSequential;
	@echo "Compiled everything.";

smallPar:
	$(ARRUMA_MPI)
	$(CC) smallTextParallel.c processaFrase.c -o smallTextParallel $(CFLAGS);
	@echo "Compiled successful. To run, type:";
	@echo "    mpirun -np <number of computers> smallTextParallel";

smallSeq:
	$(ARRUMA_MPI)
	$(CC2) smallTextSequential.c processaFrase.c -o smallTextSequential;
	@echo "Compiled successful. To run, type:";
	@echo "    ./smallTextSequential";

bigPar:
	$(ARRUMA_MPI)
	$(CC) bigTextParallel.c eratostenes.c -o bigTextParallel $(CFLAGS);
	@echo "Compiled successful. To run, type:";
	@echo "    mpirun -np <number of computers> bigTextParallel";

bigSeq:
	$(ARRUMA_MPI)
	$(CC2) bigTextSequential.c eratostenes.c -o bigTextSequential;
	@echo "Compiled successful. To run, type:";
	@echo "    ./bigTextSequential";

clean:
	rm -f *~;
	rm -f smallTextParallel;
	rm -f smallTextSequential;
	rm -f bigTextParallel;
	rm -f bigTextSequential;

